package Javalesson7;

import java.util.Scanner;

public class SingerScore {
    public static void main(String[] args) {
        //第一步：定义数组并初始化
        //int[] scores = {90,78,90,96,67,86,78,92,97,85};

        //优化：评委分从键盘输入
        int[] scores = new int[10];
        Scanner scanner = new Scanner(System.in);
        for (int i = 0; i < scores.length; i++) {
            System.out.println("请输入第"+(i+1)+"个评委所大的分数：");
            int score = scanner.nextInt();
            scores[i] = score;
        }scanner.close();

        //第二部：遍历数组，输出数组中的每一个元素
        for (int i = 0; i < scores.length; i++) {
            System.out.print(scores[i]+"");
        }

        //第三部：求数组的最值
        int max =scores[0];
        int min = scores[0];
        int sum = 0;
        for (int i = 0; i < scores.length; i++) {
            //求最大值
            if (max < scores[i]){
                max = scores[i];
            }

            //求最小值
            if (min >scores[i]){
                min = scores[i];
            }
            //求总分数
            sum = sum + scores[i];
        }
    }
}